home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
nihcl-30.lha
/
nihcl-3.0
/
vectest
/
shortvec.v
< prev
next >
Wrap
Text File
|
1990-05-16
|
4KB
|
81 lines
Test Vector ShortVec class
IntVec I(3,1,2): 1 3 5
ShortVec A(10,1): 1 2 3 4 5 6 7 8
9 10
ShortVec B(10,10,-1): 10 9 8 7 6 5 4 3
2 1
ShortVec T(A): 1 2 3 4 5 6 7 8
9 10
ShortVec U(A(0,5,2)): 1 3 5 7 9
C = U: 1 3 5 7 9
C = C: 1 3 5 7 9
C = A(0,5,2): 1 3 5 7 9
C = A; C = C(0,5,2): 1 3 5 7 9
C = A[A>B]: 6 7 8 9 10
C = A; C = C[C>B]: 6 7 8 9 10
C = A[I]: 2 4 6
C = A; C = C[I]: 2 4 6
C = 0: 0 0 0
C = A; C(0,5,2) = ShortVec(5,-1,0): -1 2 -1 4 -1 6 -1 8
-1 10
C(1,5,2) = C(0,5,2): -1 -1 -1 -1 -1 -1 -1 -1
-1 -1
C(0,3,1) = A[I]: 2 4 6 -1 -1 -1 -1 -1
-1 -1
C(3,3,1) = A[A<=3]: 2 4 6 1 2 3 -1 -1
-1 -1
C(0,6,1) = 0: 0 0 0 0 0 0 -1 -1
-1 -1
C = -A: -1 -2 -3 -4 -5 -6 -7 -8
-9 -10
C++: 0 -1 -2 -3 -4 -5 -6 -7
-8 -9
C = A-B: -9 -7 -5 -3 -1 1 3 5
7 9
C = A-1: 0 1 2 3 4 5 6 7
8 9
C = 1+A: 2 3 4 5 6 7 8 9
10 11
A>B: 0 0 0 0 0 1 1 1 1 1
A<=5: 1 1 1 1 1 0 0 0 0 0
5<A: 0 0 0 0 0 1 1 1 1 1
C = A; C += A: 2 4 6 8 10 12 14 16
18 20
C -= 1: 1 3 5 7 9 11 13 15
17 19
C = A; C[I] = ShortVec(3,-1,0): 1 -1 3 -1 5 -1 7 8
9 10
C[I] = A[I]: 1 2 3 4 5 6 7 8
9 10
C[I] = A[A<=3]: 1 1 3 2 5 3 7 8
9 10
C[I] = A(0,3,2): 1 1 3 3 5 5 7 8
9 10
C[I] = -1: 1 -1 3 -1 5 -1 7 8
9 10
C = A[I]+B[I]: 11 11 11
C = A; C[A<=5] = ShortVec(5,-1,0): -1 -1 -1 -1 -1 6 7 8
9 10
C = A; C[A<=3] = A[I]: 2 4 6 4 5 6 7 8
9 10
C = A; C[A<=5] = B[A<=5]: 10 9 8 7 6 6 7 8
9 10
C = A; C[A<=5] = A(0,5,1): 1 2 3 4 5 6 7 8
9 10
C = A; C[A<=5] = 0: 0 0 0 0 0 6 7 8
9 10
C = A[A<=5] + B[B<=5]: 6 6 6 6 6
abs(ShortVec(10,-5)): 5 4 3 2 1 0 1 2
3 4
cumsum(ShortVec(10,1)): 1 3 6 10 15 21 28 36
45 55
delta(cumsum(ShortVec(10,1))): 1 2 3 4 5 6 7 8
9 10
dot(A,B): 220
max(A): 9
min(A): 0
prod(A(0,5,1)): 120
reverse(A): 10 9 8 7 6 5 4 3
2 1
sum(A): 55